import request from '@/utils/request'

/**
 * @description 列表
 * @param data
 * @returns
 */
export const getGroupListApi: IGetGroupListApi = function (params) {
  return request.get('htscrm/store/group/list', { params });
};

/**
 * @description 所有数据
 * @param params
 * @returns
 */
export const getGroupTreeApi: IGetGroupTreeApi = function(params) {
  return request.get(`htscrm/store/group/tree`, { params })
}

/**
 * @description 详情
 * @param data
 * @returns
 */
export const getGroupDetailApi: IGetGroupDetailApi = function (id) {
  return request.get(`htscrm/store/group/info/${id}`);
};

/**
 * @description 添加
 * @param data
 * @returns
 */
export const addGroupApi: IAddGroupApi = function (data) {
  return request.post('htscrm/store/group/add', data);
};

/**
 * @description 编辑
 * @param data
 * @returns
 */
export const updateGroupApi: IUpdateGroupApi = function (data) {
  return request.post(`htscrm/store/group/edit/${data.id}`, data);
};

/**
 * @description 删除
 * @param data
 * @returns
 */
export const deleteGroupApi: IDeleteGroupApi = function (id) {
  return request.post(`htscrm/store/group/del/${id}`);
};

/**
 * @description 修改门店分组
 * @param data
 * @returns
 */
export const allChangeGroupApi: IEditGroupApi = function (data) {
  return request.post(`htscrm/store/allChangeGroup`, data);
};

/**
 * @description 修改门店分组
 * @param data
 * @returns
 */
export const allChangeStoreApi: IEditGroupApi = function (data) {
  return request.post(`htscrm/users/allChangeStore`, data);
};

/**
 * @description 获取分组树
 * @param data
 * @returns
 */
export const getStoreTreeApi: IGetStoreTreeApi = function () {
  return request.get(`htscrm/store/group/store_tree`);
};
